package com.ym.manager.admin.statics;

import com.ym.utils.StringHandler;

import java.util.List;
import java.util.Map;

/**
 * @Author 但何非
 * @Date 2022/12/13 20:33
 * @ClassName: StaticsVo
 * @Description:
 * @Version:
 */
public class StaticsVo {

    public int dayTime;

    public String beginTime;

    public String endTime;

    public int payNum;

    public String payAmount;
    public int payYhkNum;

    public String payYhkAmount;
    public int payZfbNum;

    public String payZfbAmount;

    public int withdrawNum;

    public String withdrawAmount;

    public String freeAmount;

    public int withdrawYhkNum;

    public String withdrawYhkAmount;

    public String freeYhkAmount;


    public int withdrawZfbNum;

    public String withdrawZfbAmount;

    public String freeZfbAmount;

    public String zfbTotalAmount;

    public int zfbTotalUser;

    public String bankTotalAmount;

    public int bankTotalUser;

    public List<ZfbMoneyInfoVo> payZfb;

    public List<ZfbMoneyInfoVo> withdrawZfb;

    public StaticsVo(){
    }

    public StaticsVo(Map<String,Object> payMap,Map<String,Object> withdrawMap){
        this.payNum = StringHandler.getInt(payMap.get("num"));
        this.payAmount = StringHandler.getString(payMap.get("amount"),0);
        this.withdrawNum = StringHandler.getInt(withdrawMap.get("num")+"");
        this.withdrawAmount = StringHandler.fenToYuan(withdrawMap.get("amount")+"");
        this.freeAmount = StringHandler.fenToYuan(withdrawMap.get("fee")+"");
    }

    public StaticsVo(Map<String, Object> payMap, Map<String, Object> withdrawMap, long zfbTotalAmount, int zfbTotalUser, long bankTotalAmount,
                     int bankTotalUser,Map<String, Object> payYhkMap, Map<String, Object> withdrawYhkMap,Map<String, Object> payYsYhkMap, Map<String, Object> withdrawYsMap) {
        //总支付信息
        if(StringHandler.isNotEmpty(payMap)){
            this.payNum = StringHandler.getInt(payMap.get("num"));
            this.payAmount = StringHandler.fenToYuan(StringHandler.getString(payMap.get("amount")));
        }
        //银行卡支付信息
        if(StringHandler.isNotEmpty(payYhkMap)){
            this.payYhkNum = StringHandler.getInt(payYhkMap.get("num"));
            this.payYhkAmount = StringHandler.fenToYuan(StringHandler.getString(payYhkMap.get("amount"),0));
        }
        //支付宝支付信息
        if(StringHandler.isNotEmpty(payYsYhkMap)) {
            this.payZfbNum = this.payNum - this.payYhkNum - StringHandler.getInt(payYsYhkMap.get("num"));
            this.payZfbAmount = StringHandler.getString(StringHandler.getDouble(this.payAmount) - StringHandler.getDouble(this.payYhkAmount) - (StringHandler.getLong(StringHandler.getString(payYsYhkMap.get("amount")))/100));
        }else{
            this.payZfbNum = this.payNum - this.payYhkNum;
            this.payZfbAmount = StringHandler.getDouble(this.payAmount) - StringHandler.getDouble(this.payYhkAmount) + "";
        }
        //总提现信息
        if(StringHandler.isNotEmpty(withdrawMap)){
            this.withdrawNum = StringHandler.getInt(withdrawMap.get("num")+"");
            this.withdrawAmount = StringHandler.fenToYuan(withdrawMap.get("amount")+"");
            this.freeAmount = StringHandler.fenToYuan(withdrawMap.get("fee")+"");
        }
        //银行卡提现信息
        if(StringHandler.isNotEmpty(withdrawYhkMap)){
            this.withdrawYhkNum = StringHandler.getInt(withdrawYhkMap.get("num")+"");
            this.withdrawYhkAmount = StringHandler.fenToYuan(withdrawYhkMap.get("amount")+"");
            this.freeYhkAmount = StringHandler.fenToYuan(withdrawYhkMap.get("fee")+"");
        }
        //支付宝提现信息
        if(StringHandler.isNotEmpty(withdrawYsMap)){
            this.withdrawZfbNum = (StringHandler.isNotEmpty(withdrawMap) ? StringHandler.getInt(withdrawMap.get("num")) : 0)
                    - (StringHandler.isNotEmpty(withdrawYhkMap) ? StringHandler.getInt(withdrawYhkMap.get("num")) : 0) - StringHandler.getInt(withdrawYsMap.get("num"));
            this.withdrawZfbAmount = StringHandler.fenToYuan(StringHandler.getString((StringHandler.isNotEmpty(withdrawMap) ? StringHandler.getLong(withdrawMap.get("amount")) : 0)
                    - (StringHandler.isNotEmpty(withdrawYhkMap) ? StringHandler.getLong(withdrawYhkMap.get("amount")) : 0) - StringHandler.getLong(withdrawYsMap.get("amount"))));
            this.freeZfbAmount = StringHandler.fenToYuan(StringHandler.getString((StringHandler.isNotEmpty(withdrawMap) ? StringHandler.getLong(withdrawMap.get("fee")) : 0)
                    - (StringHandler.isNotEmpty(withdrawYhkMap) ? StringHandler.getLong(withdrawYhkMap.get("fee")) : 0) - StringHandler.getLong(withdrawYsMap.get("fee"))));
        }else {
            this.withdrawZfbNum = (StringHandler.isNotEmpty(withdrawMap) ? StringHandler.getInt(withdrawMap.get("num")) : 0)
                    - (StringHandler.isNotEmpty(withdrawYhkMap) ? StringHandler.getInt(withdrawYhkMap.get("num")) : 0);
            this.withdrawZfbAmount = StringHandler.fenToYuan(StringHandler.getString((StringHandler.isNotEmpty(withdrawMap) ? StringHandler.getLong(withdrawMap.get("amount")) : 0)
                    - (StringHandler.isNotEmpty(withdrawYhkMap) ? StringHandler.getLong(withdrawYhkMap.get("amount")) : 0)));
            this.freeZfbAmount = StringHandler.fenToYuan(StringHandler.getString((StringHandler.isNotEmpty(withdrawMap) ? StringHandler.getLong(withdrawMap.get("fee")) : 0)
                    - (StringHandler.isNotEmpty(withdrawYhkMap) ? StringHandler.getLong(withdrawYhkMap.get("fee")) : 0)));
        }

        this.zfbTotalAmount = StringHandler.fenToYuan(zfbTotalAmount+"");
        this.zfbTotalUser = zfbTotalUser;
        this.bankTotalAmount = StringHandler.fenToYuan(bankTotalAmount+"");
        this.bankTotalUser = bankTotalUser;
    }
}
